Content starts here Building a Java LDAP Application
This page last changed on Jun 23, 2008.

edocs Home > BEA AquaLogic Data Services Platform 3.0/3.2 Documentation > ALDSP 3.2 New Features Documentation

How To Build a Java LDAP Application

This topic describes how to build the LDAP sample Java application, ldap_java.jar. The functions in the application can then be used as the basis for a data service.


Topic Map


Supporting LDAP Server Entries Through Data Services

Preparing to Build the Sample Application

In order to run this sample you must have ALDSP 3.2 or 3.01 installed and have downloaded and opened the LDAP sample file. The file can be obtained at:

http://download.oracle.com/docs/cd/E13167_01/aldsp/docs30/code/LdapJavaDsp32.zip

  1. Download the file.
  2. Unzip to a local directory.

Editing the build.properties File

If your BEA_HOME is different than

C:\bea

you will need to modify the build.properties file located in the LdapJavaDsp32 directory to specify the location of the BEA home directory.

  1. Open the build.properties file.
  2. Modify the bea.home property to specify your BEA home directory.
    The default setting is:
    bea.home=C:\bea
  3. If necessary, change the setting to correspond with the location of your BEA_HOME.
  4. Save your file.

Setting the Embedded LDAP Server Credentials

You need to set the credentials for the embedded LDAP server to match the password configured for the sample application.

To configure the LDAP server credentials:

  1. Start the ALDSP-enabled WebLogic Server (10.0 MP1 or 9.2).
  2. Using a web browser, launch the WebLogic Server Console by navigating to the following URL:
  3. Click Lock & Edit in the Change Center of the Administration Console.
  4. In the left pane, click the name of the domain you are configuring (for example, aldsp).
  5. Select Security > Embedded LDAP.

    WebLogic Console - Embedded LDAP Security Settings

  6. Type the following value in the Credential and Confirm Credential fields:
    secret
  7. Click Save > Activate Changes
    The Activate Changes option is only active if you are changing the default credential password.
  8. Restart your ALDSP server.



    Configuring the Sample Application to Use an Alternative LDAP Server

    The sample application is configured to use the WebLogic embedded LDAP server. You can, however, use the sample application with any LDAP server that has a Distinguished Name (DN) with a list of inetOrgPerson instances.
    To configure the sample application to use an alternative LDAP server:

              1. Open the springldap.xml file.
                You can find the springldap.xml file in the following directory:
                <_LDAP-sample-app-dir_>/src/com/example/ldap/springldap.xml
              2. Edit the following values:
                Property
                Element
                url <property name="url" value="ldap://localhost:7001" />
                base <property name="base" value="dc=aldsp" />
                userName <property name="userName" value="cn=Admin" />
                password
                <property name="password" value="secret" />
              3. Save the file.

Building the Sample Application

The next step involves building the sample application, including the Java Spring LDAP classes.

In a terminal window set up the Ant environment by running the following command:

<WEBLOGIC_HOME>/server/bin/setWLSEnv.cmd

To build the sample application:

  1. Navigate to the root directory where you placed the LdapJavaDsp32 sample.
  2. Run:
ant dist

This builds the Java Spring LDAP classes.

Building the Sample Application Using Ant

Testing the Sample Application

You can test the sample application against the LDAP server.

To test the sample application run the following command to test the Java Spring LDAP classes:

ant test-app

You should see output similar to that shown in the following screen capture.

Running the Sample Application Using Ant

Next Step

Related Topics

Concepts
How Tos
Document generated by Confluence on Jun 23, 2008 11:27